package com.kaishengit.service;

import com.kaishengit.dao.IdeaDao;
import com.kaishengit.entity.Idea;
import com.kaishengit.util.Page;

public class IdeaService {
	IdeaDao dao=new IdeaDao();
	public boolean save(Idea i){
		return dao.save(i);
	}
	public int getpagenum(){
		 Long l= dao.getCount();
		 return l.intValue();
		
	}
	public Idea findById(String id){
		return dao.findById(id);
	}
	public boolean updateIdea(String id,String title,String content){
		return dao.update(id, title, content);
	}
	public boolean delIdea(String id){
		return dao.del(id);
	}
	public Page<Idea> findAll(int pageNum){
		Page<Idea> page=new Page<Idea>(5,dao.getCount(),pageNum);
		page.setPageNum(pageNum);
		page.setPageSize(5);
		page.setTotalCount(dao.getCount());
		
		return dao.findAll(page);
	}


}
